<?php

namespace App\Http\Controllers\Upload;

use App\Http\Controllers\Controller;
use App\Models\SystemAttachmentCategory;
use App\Traits\Controllers\DestroyTraits;
use App\Traits\Controllers\IndexTraits;
use App\Traits\Controllers\StoreTraits;
use App\Traits\Controllers\UpdateTraits;
use App\Transformers\System\SystemAttachmentCategoryTransformer;
use Illuminate\Http\Request;

class SystemAttachmentCategoryController extends Controller
{
    use IndexTraits,StoreTraits,DestroyTraits,UpdateTraits;

    public $model = SystemAttachmentCategory::class;
    public $transformer = SystemAttachmentCategoryTransformer::class;

    public function rules(Request $request): array
    {
        switch ($request->method()) {
            case 'POST':
            case 'PATCH':
                return [
                    'name' => 'required',
                    'english_name' => 'required',
                ];
        }
        return [];
    }

    public function ruleMessages(): array
    {
        return [
            'name.required' => '名字 不能为空',
            'english_name.required' => '名字 不能为空',
        ];
    }
}
